#include <iostream>
#include <fstream>
#include <string>
#include "hash.cpp"

using namespace std;

void print_record(record &r, int &count)
{
	cout << "ID: " << r.id << endl;
	cout << "Name: " << r.name << endl;
	cout << "Address: " << r.name << endl;
	cout << "Data found with " << count << " times query." << endl << endl;
}

int main()
{
	hash db;
	int status, p, count;
	record temp;
	string id;
	// fstream fp("data.txt", ios::in);

	cout << "Type id to search, type exit to quit the program." << endl;
	cin >> id;
	while(id != "exit")
	{
		count = 1;
		status = db.search(id, p, count);
		if(status)
			print_record(db.elem[p], count);
		else
			cout << "Not Found" << endl;
		cin >> id;
	}

	return 0;
}
